<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no" name="viewport">
    <title>夏至网盘-用户管理</title>

    <link rel="stylesheet" href="u-admin/dist/modules/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="u-admin/dist/modules/ionicons/css/ionicons.min.css">
    <link rel="stylesheet" href="u-admin/dist/modules/fontawesome/web-fonts-with-css/css/fontawesome-all.min.css">

    <link rel="stylesheet" href="u-admin/dist/modules/summernote/summernote-lite.css">
    <link rel="stylesheet" href="u-admin/dist/modules/flag-icon-css/css/flag-icon.min.css">
    <link rel="stylesheet" href="u-admin/dist/css/demo.css">
    <link rel="stylesheet" href="u-admin/dist/css/style.css">
    <link rel="stylesheet" href="plug-ins/xcConfirm/css/xcConfirm.css">
    <link rel="stylesheet" href="plug-ins/context-menu/css/contextMenu.css">
    <style>
        .files-items{
            margin-top: -20px;
            border-bottom: 1px dashed #bdc3c7;
            border-top: 1px dashed #bdc3c7;
        }
        .files-items:hover{
            background: #F4FBFF;
        }
    </style>

</head>

<body>
<div id="app">
    <div class="main-wrapper">
        <div class="navbar-bg"></div>
        <div th:replace="commons/bar::#top"></div>
        <div th:replace="commons/bar::#sidebar(currUri='admin',statistics = ${statistics})"></div>

        <div class="main-content">
            <section class="section">
                <h1 class="section-header">
                    <div><i class="ion ion-person"></i> 用户管理</div>
                </h1>
                <div class="row" style="margin-top: -10px">
                    <div class="col-12 col-sm-12 col-lg-12 table-responsive">
                        <table class="table tab-bordered text-nowrap">
                            <tr class="empty-space">
                                <th>ID</th>
                                <th>用户名</th>
                                <th>头像</th>
                                <th>创建时间</th>
                                <th>权限</th>
                                <th>仓库容量</th>
                                <th>已用容量</th>
                                <th>操作</th>
                            </tr>
                            <tr th:id="${u.id}" th:each="u:${userDTOS}" class="files-items files">
                                <td th:text="${u.id}"></td>
                                <td th:text="${u.name}"></td>
                                <td><img th:src="${u.image}" width="25px"></td>
                                <td th:text="${#dates.format(u.createTime, 'yyyy-MM-dd HH:mm')}"></td>
                                <td>
                                    <select th:filed="${u.level}" th:value="${u.level}" name="level" class="u-level">
                                        <option th:selected="${u.level==0}" value="0">正常</option>
                                        <option th:selected="${u.level==1}" value="1">禁止上传文件</option>
                                        <option th:selected="${u.level==2}" value="2">禁止下载文件</option>
                                        <option th:selected="${u.level==3}" value="3">禁止操作</option>
                                    </select>
                                </td>
                                <td><input style="width: 150px" th:value="${u.maxSize/1024}" class="u-max">MB</td>
                                <td th:if="${u.currentSize > 1024}" th:text="${u.currentSize/1024 +'MB'}"></td>
                                <td th:if="${u.currentSize < 1024}" th:text="${u.currentSize +'KB'}"></td>
                                <td><button class="btn btn-primary btn-sm" th:onclick="updateInfo([[${u.id}]])">更新</button></td>
                            </tr>
                        </table>
                    </div>
                </div>

            </section>
            <span id="tarFile" style="display: none"></span>
        </div>
        <div th:replace="commons/bar::#footer"></div>
    </div>
</div>
<script>
    function updateInfo(id) {
        let level = $('#' + id + ' .u-level').val()
        let size = $('#' + id + ' .u-max').val()
        var location = window.location.href;
        let strings = location.split("admin");
        window.location.href = strings[0] + 'updateUserLevel?level=' + level + '&size=' + size + '&uId=' + id
    }
</script>
<script src="plug-ins/context-menu/js/jquery.contextMenu.min.js"></script>
<script src="plug-ins/xcConfirm/js/xcConfirm.js"></script>
<script src="u-admin/dist/modules/jquery.min.js"></script>
<script src="u-admin/dist/modules/popper.js"></script>
<script src="u-admin/dist/modules/tooltip.js"></script>
<script src="u-admin/dist/modules/bootstrap/js/bootstrap.min.js"></script>
<script src="u-admin/dist/modules/nicescroll/jquery.nicescroll.min.js"></script>
<script src="u-admin/dist/modules/scroll-up-bar/dist/scroll-up-bar.min.js"></script>
<script src="u-admin/dist/js/sa-functions.js"></script>

<script src="u-admin/dist/modules/chart.min.js"></script>
<script src="u-admin/dist/modules/summernote/summernote-lite.js"></script>

<script src="u-admin/dist/js/scripts.js"></script>
<script src="u-admin/dist/js/custom.js"></script>
<script src="u-admin/dist/js/demo.js"></script>
<script src="u-admin/dist/modules/chart.min.js"></script>
</body>
</html>
